<template>
  <div class="bookshelf-content">
    <!-- 头部区域 -->
    <div class="header-section">
      <img src="/images/主体页面组件/头部header.svg" alt="头部背景" class="header-bg" />
      <div class="header-content">
        <img src="/images/主体页面组件/头部蓝酒馆logo.svg" alt="蓝酒馆logo" class="header-logo" />
        <img src="/images/主体页面组件/头部slogan.svg" alt="slogan" class="header-slogan" />
      </div>
    </div>

    <!-- 主内容区域 -->
    <div class="main-content">
      <!-- 页面标题 -->
      <div class="page-title">
        <img src="/images/我的书架/我的书架标题.svg" alt="我的书架" class="title-image" />
      </div>

      <!-- 上次阅读书籍板块 -->
      <div class="last-reading-section">
        <img src="/images/我的书架/上次阅读书籍bg.svg" alt="上次阅读背景" class="last-reading-bg" />
        <div class="last-reading-content">
          <div class="book-cover-container">
            <div class="book-cover book-cover-weicheng"></div>
          </div>
          <div class="book-details">
            <img src="/images/我的书架/围城书名.svg" alt="围城" class="book-title" />
            <img src="/images/我的书架/围城推荐指数星星.svg" alt="评分" class="book-rating" />
            <img src="/images/我的书架/围城评分.svg" alt="评分数值" class="book-score" />
            <img src="/images/我的书架/围城作者和分类.svg" alt="作者分类" class="book-author" />
            <img src="/images/我的书架/围城阅读进度.svg" alt="阅读进度" class="reading-progress" />
          </div>
          <div class="continue-reading">
            <img src="/images/我的书架/继续阅读按钮.svg" alt="继续阅读" class="continue-btn" />
          </div>
        </div>
      </div>

      <!-- 收藏的书籍板块 -->
      <div class="collected-books-section">
        <img src="/images/我的书架/收藏的书籍bg.svg" alt="收藏书籍背景" class="collected-bg" />
        <div class="collected-content">
          <div class="books-grid">
            <!-- 第一行 -->
            <div class="book-row">
              <div class="book-item">
                <img src="/images/我的书架/百年孤独.svg" alt="百年孤独" class="collected-book" />
              </div>
              <div class="book-item">
                <img src="/images/我的书架/复活.svg" alt="复活" class="collected-book" />
              </div>
              <div class="book-item">
                <img src="/images/我的书架/局外人.svg" alt="局外人" class="collected-book" />
              </div>
            </div>
            <!-- 第二行 -->
            <div class="book-row">
              <div class="book-item">
                <img src="/images/我的书架/悲惨世界.svg" alt="悲惨世界" class="collected-book" />
              </div>
              <div class="book-item">
                <img src="/images/我的书架/潮汐图.svg" alt="潮汐图" class="collected-book" />
              </div>
              <div class="book-item">
                <img src="/images/我的书架/恐惧与自由.svg" alt="恐惧与自由" class="collected-book" />
              </div>
            </div>
            <!-- 第三行 -->
            <div class="book-row">
              <div class="book-item">
                <img src="/images/我的书架/白夜行.svg" alt="白夜行" class="collected-book" />
              </div>
              <div class="book-item" @click="$router.push('/book-detail')">
                <img src="/images/我的书架/哲学家的最后一课.svg" alt="哲学家的最后一课" class="collected-book" />
              </div>
              <div class="book-item add-book">
                <img src="/images/我的书架/添加按钮.svg" alt="添加书籍" class="add-btn" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 底部导航栏 -->
    <div class="bottom-nav">
      <img src="/images/主体页面组件/底部导航栏bg.svg" alt="导航背景" class="nav-bg" />
      <div class="nav-items">
        <button class="nav-item" @click="$router.push('/home')">
          <img src="/images/主体页面组件/首页logo.svg" alt="首页" />
          <span class="nav-text">首页</span>
        </button>
        <button class="nav-item" @click="$router.push('/recommend')">
          <img src="/images/主体页面组件/推荐logo.svg" alt="推荐" />
          <span class="nav-text">推荐</span>
        </button>
        <button class="nav-item active">
          <img src="/images/主体页面组件/书架logo.svg" alt="书架" />
          <span class="nav-text">书架</span>
        </button>
        <button class="nav-item" @click="$router.push('/my')">
          <img src="/images/主体页面组件/我的logo.svg" alt="我的" />
          <span class="nav-text">我的</span>
        </button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
// 书架页面逻辑
</script>

<style scoped>
.bookshelf-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  background: rgb(255, 255, 255);
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* 禁用文本选择和拖拽 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* 头部区域样式 */
.header-section {
  position: relative;
  width: 100%;
  height: 65px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  background: #A2F2F8;
}

.header-bg {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
}

.header-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.header-logo {
  height: 30px;
  width: auto;
  transform: translateY(35%) translateX(10%);
}

.header-slogan {
  height: 40px;
  width: auto;
  transform: translateY(35%) translateX(50%);
}

/* 主内容区域样式 */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 15px;
  padding-bottom: 130px; /* 为导航栏留出空间 */
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 0;
  min-height: 0;
  /* 启用移动端原生滑动 */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* 隐藏滚动条 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 完全隐藏滚动条 */
.main-content::-webkit-scrollbar {
  display: none;
}

/* 页面标题 */
.page-title {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.title-image {
  height: 35px;
  width: auto;
  object-fit: contain;
}

/* 上次阅读书籍板块 */
.last-reading-section {
  position: relative;
  margin-bottom: 20px;
}

.last-reading-bg {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  position: relative;
  z-index: 1;
}

.last-reading-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  z-index: 2;
  display: flex;
  gap: 15px;
  align-items: center;
}

.book-cover-container {
  flex-shrink: 0;
}

.book-cover {
  width: 70px;
  height: 100px;
  border-radius: 6px;
  background: #f0f0f0;
  display: block;
  border: 1px solid #ddd;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.book-cover-weicheng {
  background-image: url('/images/我的书架/围城书籍封面.svg');
}

.book-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.book-title {
  height: 28px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.book-rating {
  height: 16px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.book-score {
  height: 16px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.book-author {
  height: 16px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.reading-progress {
  height: 12px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.continue-reading {
  flex-shrink: 0;
}

.continue-btn {
  width: 80px;
  height: 30px;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.continue-btn:hover {
  transform: scale(1.05);
}

/* 收藏的书籍板块 */
.collected-books-section {
  position: relative;
  margin-bottom: 20px;
}

.collected-bg {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  position: relative;
  z-index: 1;
}

.collected-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.books-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 5px;
}

.book-row {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  padding: 0 5px;
}

.book-item {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s ease;
  max-width: 105px;
}

.book-item:hover {
  transform: scale(1.05);
}

.collected-book {
  width: 95px;
  height: 125px;
  object-fit: contain;
  border-radius: 6px;
}

.add-book {
  display: flex;
  justify-content: center;
  align-items: center;
}

.add-btn {
  width: 60px;
  height: 60px;
  object-fit: contain;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.add-btn:hover {
  opacity: 1;
}

/* 底部导航栏样式 */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  z-index: 9999;
  margin: 0;
  padding: 0;
  background: transparent;
  padding-top: 5px;
}

.nav-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-items {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 0px 20px 20px 20px;
}

.nav-item {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px 12px 8px;
  transition: transform 0.2s ease;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.nav-item:hover {
  transform: scale(1.1);
}

.nav-item.active {
  background: rgba(0, 212, 255, 0.1);
}

.nav-item img {
  height: 32px;
  width: auto;
}

.nav-text {
  font-size: 12px;
  color: #ffffff;
  font-weight: 400;
  margin-top: 2px;
}

.nav-item.active .nav-text {
  color: #0033ff !important;
  font-weight: 500;
}

/* 响应式调整 */
@media (max-height: 700px) {
  .header-section {
    height: 100px;
  }
  
  .main-content {
    padding: 15px 12px;
    padding-bottom: 90px;
    gap: 15px;
  }
  
  .bottom-nav {
    bottom: 0;
    height: 100px;
    padding-top: 5px;
  }
  
  .nav-item img {
    height: 28px;
  }
  
  .nav-text {
    font-size: 11px;
  }
}

@media (max-width: 399px) {
  .last-reading-content {
    padding: 15px;
    gap: 12px;
  }
  
  .book-cover {
    width: 50px;
    height: 75px;
  }
  
  .collected-content {
    padding: 15px;
  }
  
  .collected-book {
    width: 70px;
    height: 85px;
  }
}
</style> 